<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
require_once '../define.php';
get_header(); ?>

	<div id="primary" class="site-content">
		<div id="content" role="main">
                <?php
                $keyword = isset($_GET['keyword'])?$_GET['keyword']:"";
                $results = twentytwelve_customize_connect_event($keyword);
                foreach($results as $val):
                    $title = $val->{'title'};
                    $image = $val->{"image"};
                    if(empty($image))
                        $image    = get_template_directory_uri().'/images/na.jpg';
                    else
                        $image    = 'http://artserv.org/public/files/event/thumb/'.$image;
                    $imgLink = '<img src="'.$image.'" width=300 >';
                    $location   = $val->{"location"};
                    $participant   = $val->{"full_name"};
                    $date       = $val->{"date"};
                    $time       = $val->{"time"};
                    $description= $val->{"description"};

                    $color      = !empty($val->{"text_color"})?'#' . $val->{"text_color"}:'#444444';
                    $bg         = !empty($val->{"bg_color"})?'#' . $val->{"bg_color"}:"yellow";
                ?>
                <div class="art-table" style="color: <?php echo $color ?>;">
                    <div class="item_title"><?php echo $imgLink; ?></div>
                    <div class="item_title" style="color: <?php echo $color ?>;background-color:<?php echo $bg ?>">
                        <div class="art-item-row">
                            <span class="art-item-title">TITLE:</span>
                            <span><?php echo $title  ?></span>
                        </div>
                        <div class="art-item-row">
                            <span class="art-item-title">LOCATION:</span>
                            <span><?php echo $location  ?></span>
                        </div>
                        <div class="art-item-row">
                            <span class="art-item-title">DATE:</span>
                            <span><?php echo $date  ?></span>
                        </div>
                        <div class="art-item-row">
                            <span class="art-item-title">TIME:</span>
                            <span><?php echo $time  ?></span>
                        </div>
                        <div class="art-item-row">
                            <div class="art-item-title">ARTSERV PARICIPANTS:</div>
                            <div><?php echo $participant  ?></div>
                        </div>
                        <div class="art-item-row">
                            <div class="art-item-title">DESCRIPTION/DETAIL:</div>
                            <div class="art-item-description"><?php echo $description  ?></div>
                        </div>

                    </div>
                    <div class="clear"></div>
                </div>
            <?php
            endforeach;
            ?>
            <div class="navigation">
                <div class="nav-previous"><?php previous_posts_link_custom('&laquo; previous page',$_SERVER['REQUEST_URI']) ?></div>
                <div class="nav-next"><?php next_posts_link_custom('next page &raquo;',$_SERVER['REQUEST_URI']) ?></div>
            </div>



		</div><!-- #content -->
	</div><!-- #primary -->

    <form action="" class="" id="searchconnect" method="get" role="search" style="display: none; width: auto; min-height: 94px; max-height: none; height: auto;">
        <div>
            <label for="s" class="screen-reader-text">Search for:</label>
            <input type="text" id="keyword" name="keyword" value="">
            <input type="submit" value="Search" id="searchsubmit">
        </div>
    </form>

<?php get_sidebar(); ?>
<?php get_footer(); ?>